/*
 * @Author: xiawei 1243162387@qq.com
 * @Date: 2024-04-15 09:15:44
 * @LastEditors: xiawei 1243162387@qq.com
 * @LastEditTime: 2024-05-08 15:49:24
 */

import { http, HttpResponse } from 'msw';
import { faker } from '@faker-js/faker';

const baseUrl = '';
const getTableList = (length = 50) => {
  const list = [];
  for (let index = 0; index < length; index++) {
    list.push( {
      id: faker.string.uuid(),
      startDate: faker.date.past(),
      endDate: faker.date.past(),
      name: faker.internet.userName(),
      state: faker.location.country(),
      city: faker.location.city(),
      address: faker.location.streetAddress(),
      zip: faker.location.zipCode(),
    });   
  }
  return list
}
const apis: Array<any> = [
  http.post(`${baseUrl}/table/list`, ({ }) => {
    return HttpResponse.json({
      errors: null,
      code: 20000,
      message: '查询成功。',
      result: {
        data: getTableList(),
        total: 10000,
      },
      success: true,
    })

  }),
  http.post(`${baseUrl}/dashboard/statistics/alarm`, () => {
    return HttpResponse.json({
      errors: null,
      code: 20000,
      message: '查询成功。',
      result: {
        xAxis: [],
        yAxis: [faker.number.int({
          min: 10,
          max: 200,
        }), faker.number.int({
          min: 10,
          max: 200,
        }), faker.number.int({
          min: 10,
          max: 200,
        }), faker.number.int({
          min: 10,
          max: 200,
        }), faker.number.int({
          min: 10,
          max: 200,
        }), faker.number.int({
          min: 10,
          max: 200,
        }), faker.number.int({
          min: 10,
          max: 200,
        })]
      },
      success: true,
    })

  }),
]
export default apis;